{load href="/public/editor/ueditor.config.js"}
{load href="/public/editor/ueditor.all.js"}
<section class="page-hd">
    <header>
        <p class="title-description title-top">
            查看留言
        </p>
    </header>
    <hr>
</section>
<form method="post" id="userForm" enctype="multipart/form-data">
    <input type="hidden" name="id" value="{$model.id}">
    <div class="form-group-col-2">
        <div class="form-label">姓名：</div>
        <div class="col-sm-5">{$model.name}</div>
    </div>
    <div class="form-group-col-2">
        <div class="form-label">邮箱：</div>
        <div class="col-sm-5">{$model.email}</div>
    </div>
    <div class="form-group-col-2">
        <div class="form-label">电话/手机号码：</div>
        <div class="col-sm-5">{$model.phone}</div>
    </div>
    <div class="form-group-col-2">
        <div class="form-label">所属行业：</div>
        <div class="col-sm-5">{$model.company}</div>
    </div>
    <div class="form-group-col-2">
        <div class="form-label">留言时间：</div>
        <div class="col-sm-5">{$model.created|date='Y-m-d H:i',###}</div>
    </div>
    <div class="form-group-col-2">
        <div class="form-label">开店区域：</div>
        <div class="col-sm-5">{$model.address}</div>
    </div>
    <div class="form-group-col-2">
        <div class="form-label">状态：</div>
        <div class="col-sm-5">{$model.stateMsg}</div>
        <input name="state" value="1" type="hidden">
    </div>
    <div class="form-group-col-2">
        <div class="form-label"></div>
        <div class="col-sm-5">
            <input type="button" id="userSubmit" class="btn btn-primary" value="审核"
                   data-url="{:url('leva/addAndUpdateNews')}"/>
        </div>
    </div>
</form>
<script>
    $('#userSubmit').on('click', function () {
        var url = $(this).attr('data-url');
        Ajax(url, $('#userForm').serialize());
    });
    function Ajax(url, data) {
        $.ajax({
            url: url,
            cache: false,
            dataType: 'json',
            data: data,
            type: 'post',
        }).done(function (res) {
            if (res.code == 200) {
                layer.alert(res.msg, function () {
                    location.href = '{:url("leva/news_list")}';
                });
            } else {
                layer.alert(res.msg);
            }
        }).fail(function (e) {
            layer.alert(e);
        });
    }
</script>